import os

src = 'E:/Research/2020ContrastiveLearningForSceneLabel/Data/20210329ExperimentData/round2/supplementSampleByHumanTxtFiles/supplement320PairPosNeg.txt'
tar = 'E:/Research/2020ContrastiveLearningForSceneLabel/Data/20210329ExperimentData/round2/supplementSampleByHumanTxtFiles/supplement320PairPosNeg_fuck.txt'

src = open(src,'r')
tar = open(tar,'w')
src_lines = src.readlines()
src.close()

anchors = []
for i in src_lines:
    anchor = i.split(':')[0]
    anchor = int(anchor.split()[0])
    anchors.append(anchor)

for idx, i in enumerate(src_lines):
    fuck = i[:-1]
    tar.write(fuck)
    tar.write(str(anchors[idx-1]) + ' ' + str(anchors[(idx + 1)%(len(anchors))]) + ' \n' )
tar.close()